package com.atguigu.lease.exception;

import com.atguigu.lease.result.ResultCodeEnum;
import lombok.Data;

/**
 * @author 51560
 * @project lease
 * @title 自定义通用异常
 * @package com.atguigu.lease.exception
 * @since 2025/5/14 上午11:08
 */
@Data
public class LeaseException extends RuntimeException {

    private int code;

    public LeaseException(String message) {
        super(message);
    }

    public LeaseException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    public LeaseException(String message, int code) {
        super(message);
        this.code = code;
    }
}
